<template>
  <div class="main-container">
    <navbar ishome="true"></navbar>

    <!-- 轮播图 -->
    <!-- <mt-swipe :auto="4000">
      <mt-swipe-item v-for="(item,i) in banners" :key="i">
        <img :src="item.imgurl" alt="">
      </mt-swipe-item>
    </mt-swipe> -->
    <swipe :imgList="banners"></swipe>

    <ul class="mui-table-view mui-grid-view mui-grid-9">
      <!-- <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
        <router-link to="/home/newlist">
                  span class="mui-icon mui-icon-home"></span
          <img src="../../img/menu1.png" alt="">
          <div class="mui-media-body">新闻资讯</div>
        </router-link>
      </li>
      <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
        <router-link to="/home/photolist">
          <img src="../../img/menu2.png" alt="">
          <div class="mui-media-body">图片分享</div>
        </router-link>
      </li>
      <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
        <router-link to="/home/shop/goodslist">
          <img src="../../img/menu3.png" alt="">
          <div class="mui-media-body">商品购买</div>
        </router-link>
      </li>
      <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
        <a href="#">
          <img src="../../img/menu4.png" alt="">
          <div class="mui-media-body">留言反馈</div>
        </a>
      </li>
      <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
        <a href="#">
          <img src="../../img/menu5.png" alt="">
          <div class="mui-media-body">视频专区</div>
        </a>
      </li>
      <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
        <a href="#">
          <img src="../../img/menu6.png" alt="">
          <div class="mui-media-body">联系我们</div>
        </a>
      </li>
      <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
        <a href="#">
          <img src="../../img/menu5.png" alt="">
          <div class="mui-media-body">视频专区</div>
        </a>
      </li>
      <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
        <a href="#">
          <img src="../../img/menu6.png" alt="">
          <div class="mui-media-body">联系我们</div>
        </a>
      </li>
 -->

    </ul>

    <div class="viewWrap">
      <div class="imgArcViewWrap">
        <div class="imgArcView"></div>
      </div>
      <ul class="quick-nav-ul">
        <li>
          <a href="#">
            <img src="https://m.360buyimg.com/mobilecms/jfs/t16912/18/2046755333/11079/5d93a046/5ae41d1aN7c1bb190.png" alt="">
            <div class="mui-media-body">特惠超市</div>
          </a>
        </li>
        <li>
          <a href="#">
            <img src="https://m.360buyimg.com/mobilecms/jfs/t21658/347/221358098/7461/f86e6f74/5b03b170Nc9e0ec7c.png" alt="">
            <div class="mui-media-body">全球购</div>
          </a>
        </li>
        <li>
          <a href="#">
            <img src="https://m.360buyimg.com/mobilecms/jfs/t18865/90/1804471517/14538/72c79ba/5ad87b67N1ebcb69b.png" alt="">
            <div class="mui-media-body">我爱服饰</div>
          </a>
        </li>
        <li>
          <a href="#">
            <img src="https://m.360buyimg.com/mobilecms/jfs/t17725/156/1767366877/17404/f45d418b/5ad87bf0N66c5db7c.png" alt="">
            <div class="mui-media-body">好吃生鲜</div>
          </a>
        </li>
        <li>
          <a href="#">
            <img src="https://m.360buyimg.com/mobilecms/jfs/t16990/157/2001547525/17770/a7b93378/5ae01befN2494769f.png" alt="">
            <div class="mui-media-body">小时到家</div>
          </a>
        </li>
        <li>
          <a href="#">
            <img src="https://m.360buyimg.com/mobilecms/jfs/t18454/342/2607665324/6406/273daced/5b03b74eN3541598d.png" alt="">
            <div class="mui-media-body">充值缴费</div>
          </a>
        </li>
        <li>
          <a href="#">
            <img src="https://m.360buyimg.com/mobilecms/jfs/t22228/270/207441984/11564/88140ab7/5b03fae3N67f78fe3.png" alt="">
            <div class="mui-media-body">9.9元拼</div>
          </a>
        </li>
        <li>
          <a href="#">
            <img src="https://m.360buyimg.com/mobilecms/jfs/t19495/200/1823004232/14065/ca00ab2c/5ad87cf5N4ad8e6f1.png" alt="">
            <div class="mui-media-body">领劵</div>
          </a>
        </li>
        <li>
          <a href="#">
            <img src="https://m.360buyimg.com/mobilecms/jfs/t16828/63/2653634926/5662/d18f6fa1/5b03b779N5c0b196f.png" alt="">
            <div class="mui-media-body">赚钱</div>
          </a>
        </li>
        <li>
          <a href="#">
            <img src="https://m.360buyimg.com/mobilecms/jfs/t21481/263/412160889/15938/4246b4f8/5b0cea29N8fb2865f.png" alt="">
            <div class="mui-media-body">全部</div>
          </a>
        </li>
      </ul>
    </div>
    <div class="subjectbox">
      <img src="../../img/q70.jpg" alt="">
    </div>
    <router-link to="/goods" tag="div" class="dframeLayout">
      <div class="dframeLayout-box">
        <div class="left">
          <div></div>
        </div>
        <div class="right">
          <div></div>
        </div>
      </div>
      <div class="dframeLayout-box">
        <div class="item">
          <img src="../../img/22.jpg" alt="">
          <img src="../../img/23.jpg" alt="">
          <img src="../../img/21.jpg" alt="">
        </div>
      </div>
      <div class="zhibo">购物直播</div>
    </router-link>
    <div class="subjectbox">
      <img src="../../img/ash70.jpg" alt="">
    </div>
    <div class="dframeLayout">
      <router-link to="/home/photos" tag="div"  class="dframeLayout-box photobox">
        <div class="right">
          <div></div>
        </div>
        <div class="left">
          <div></div>
        </div>
      </router-link>
      <div class="zhibo">图片分享</div>
    </div>
    
    <div class="subjectbox">
      <img src="../../img/ts70.jpg" alt="">
    </div>
    <recommend></recommend>
  </div>



</template>

<script>
  //import $ from "jquery";

  //导入封装的轮播组件
  import swipe from '../mtuiswipe.vue'
  import NavBar from '../common/navbar.vue'
  //推荐商品
  import recommend from '../common/Recommend.vue'

  export default {
    data() {
      return {
        // 默认的轮播图列表
        banners: [
          // {src:'http://f.hiphotos.baidu.com/image/pic/item/63d0f703918fa0ece5f167da2a9759ee3d6ddb37.jpg'},
          // {src:'https://ss1.baidu.com/6ONXsjip0QIZ8tyhnq/it/u=1404515416,1646329256&fm=173&app=25&f=JPEG?w=640&h=360&s=89F17186963699D60EC10C9303001087'},
          // {src:'https://ss2.baidu.com/6ONYsjip0QIZ8tyhnq/it/u=628548515,497571507&fm=173&app=25&f=JPEG?w=640&h=360&s=CBD4428E48100AD62E9527BD03009006'},
          // {src:'https://ss0.baidu.com/6ONWsjip0QIZ8tyhnq/it/u=2354079915,1044378348&fm=173&app=25&f=JPEG?w=640&h=360&s=E05214C7CA30108452FDDCB003004011'}
        ]
      };
    },
    created() {
      this.getBannerList();
    },
    methods: {
      // 获取轮播图列表
      getBannerList() {
        this.$http.get("api/getbannerlist").then(
          res => {
            console.log("获取轮播图列表成功");
            console.log(res);
            if (res.body.status == 0) {
              this.banners = res.body.message;
              this.banners.forEach(item => {
                item.src = item.imgurl;
              });

            } else {
              console.log("no");
            }
          },
          res => {
            console.log("error callback");
            console.log(res);
          }
        );

        /*
              $.ajax({
                  url: "http://127.0.0.1:8888/api/getbannerlist",
                  type: "GET",
                  dataType: "jsonp",
                  success: function (data) {
                      console.log('ok callback');
                      var result = JSON.stringify(data); //json对象转成字符串
                      console.log(result)
                  },
                  error:function(result){
                      console.log('error callback');
                      console.log(result)
                  }
              });*/
      }
    },
    components: {
      swipe,
      navbar: NavBar,
      recommend
    }
  };
</script>

<style lang="scss">
  .mint-swipe-indicators {
    bottom: 20px;
  }
</style>

<style lang="scss" scoped>
  .main-container {
    padding: 0 0 20px 0;
  }

  .mui-grid-view.mui-grid-9 {
    background-color: #fff;
    border: 0;

    img {
      width: 60px;
      height: 60px;
    }
    .mui-media-body {
      font-size: 14px;
    }
  }

  .mui-grid-view.mui-grid-9 .mui-table-view-cell {
    border: 0;
  }


  .viewWrap {
    position: relative;
    margin-top: -20px;
  }

  .quick-nav-ul {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-top: -10px;
    li {
      width: 20%;
      text-align: center;
      margin-bottom: 10px;

      a {
        font-size: 14px;
        color: #686868;
      }
      img {
        width: 44px;
        height: 44px;
      }
    }

  }

  .viewWrap {
    position: relative;
    margin-top: -20xp;
    .imgArcViewWrap {
      height: 30px;
      background: #fff;
      border-radius: 100px;
    }
  }

  .dframeLayout {
    position: relative;
    margin-top: 15px;
    .zhibo {
      position: absolute;
      top: -13px;
      left: 0;
      background: #ff659d;
      padding: 6px 15px;
      color: #fff;
      border-top-right-radius: 30px;
      border-bottom-right-radius: 30px;
      font-size: 14px;
    }
    .dframeLayout-box {
      display: flex;
      height: 120px;
      .left {
        width: 70%;

        div {
          width: 100%;
          height: 100%;
          background-repeat: no-repeat;
          background-position: center center;
          background-size: cover;
          background-image: url('../../img/dgshop.jpg');
        }
      }
      .right {
        width: 30%;

        div {
          width: 100%;
          height: 100%;
          background-repeat: no-repeat;
          background-position: center center;
          background-size: cover;
          background-image: url('../../img/333.jpg');
        }

      }
      .item {
        display: flex;
        width: 100%;

        img {
          width: 33.33333%;
        }
      }

    }
    .photobox{
        .left{
          div{

          background-image: url('https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1533481754&di=16cd439c5aea4baf2733d64543e22772&imgtype=jpg&er=1&src=http%3A%2F%2Fold.bz55.com%2Fuploads%2Fallimg%2F121128%2F1-12112Q00036.jpg');
          }
        }
        .right{
          div{
          background-image: url('https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1532887048371&di=60078f2e9908544dcb5aab4ac0ccb485&imgtype=0&src=http%3A%2F%2Fimg4.duitang.com%2Fuploads%2Fblog%2F201404%2F06%2F20140406232455_m5XVy.jpeg');
            
          }
        }
    }
  }

  .subjectbox {
    img {
      width: 100%;
    }
  }
</style>